<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../include/base.jsp" %>
<html lang="en-US">
<head>
	
	<title>KaiSheng-客户管理系统</title>
	
	<%@include file="../include/top.jsp" %>
	<style type="text/css">
		#myform{
			margin-left:50px;
		}
		#myform label{
			font-size:16px;
			width:80px;
			font-family:微软雅黑;
		}
		#myform input{
			height:30px;
		}
		#myform .controls{
			margin-left:100px;
		}
		#myform select{
			width:80px;
		}
	</style>
</head>
<body>
	<jsp:include page="../include/header.jsp">
	</jsp:include>
	
	<div class="container" style="margin-top:20px;width:100%" >
		<div class="row">
			<div class="span3 offset1" style="width:15%">
				<div class="box" style="border:0px solid #DDDDDD;font-size:18px;font-family:微软雅黑;">
					<ul class="nav nav-list"  id="myul">
						<li ><a href="#"><i class="icon-home"></i>最新动态</a></li>
						<li class="active"><a href="#"><i class="icon-user"></i>联系人</a></li>
						<li><a href="#"><i class="icon-fire"></i>任务</a></li>
						<li><a href="#"><i class="icon-file"></i>交易</a></li>
					</ul>
				</div>
			</div>
			<div class="span6 well" style="padding:0px;margin-left:10px;width:67%;border-radius:15px;border: 1px solid #DDDDDD;height:auto;">

				<div class="well" style="float:right;height:auto;width:25%;padding:15px;border:0px;font-size:18px;font-family:微软雅黑;" >
					<!--编辑联系人页面 的右页面 -->
					<div class="well" style="border:0px;">
							<div class="avatar" style="width:80px;height:80px;background-color:#DBEAF9;">
								<img src="#" alt="" /><br />	
							</div><br />
						<a class="btn btn-danger" href="/people/816936" data-confirm="您确定要删除这个联系人吗？ 所有与这个联系人相关的机会， 联系信息， 事件， 文件以及任务都将被删除。 删除后不能再恢复。" 
						data-method="delete" rel="nofollow" title="删除这个联系人"><i class="icon icon-trash"></i>删除这个联系人</a> 
						<br /><br />
						 <a id="example3" 
							class="btn btn-warning"
							data-trigger="click" 
							data-animation="true" 
							data-placement="bottom"  
							data-content="
								<div class='modal-body' style='padding:0px;'>
									纪念日主题<br/>
									<select name='' id='' style='width:130px;'>
										<option value=''>无</option>
										<option value=''>自己生日</option>
										<option value=''>结婚纪念日</option>
										<option value=''>父母生日</option>
										<option value=''>子女生日</option>
										<option value=''>其他</option>
									</select>
									<a href='edittype.html'>编辑类别</a> <br/>
									输入具体日期<br/>
									<input type='text' name='' id='' style='width:130px;'/><br/>
										
									大致内容<br/>
									<textarea id='person_others' class='text optional content span1' rows='5' name='remday.content' cols='40'></textarea>
								 </div>
								  <div class='modal-footer' style='padding:10px 0px;'>
									<button class='btn btn-success'><span style='font-size:14px'>添加纪念日</span></button>
									&nbsp;&nbsp;或者<button type='reset' class='btn'>取消</button>
								  </div>
							" 
							rel="popover" href="#" data-original-title="添加纪念日">
								<i class="icon-plus"></i>添加纪念日
							</a>
					</div>
					<script type="text/javascript">
						$(document).ready(function(){
								$('#example3').popover();
							
							});
						</script>
				</div>
				<div style="border-radius:10px 0px 0px 10px ;width:70%;float:left;position:relative;height:auto;background-color:#fff;border-right:1px solid #ddd;">
						<!-- 下面是编辑联系人页面 -->
						<div class="screen" style="border-radius:0px 0px 0px 10px ;margin:0px;background-color:#fff;">
					<div class="page-header header" style="margin-top:10px;padding:10px;font-size:20px;font-family:微软雅黑;">
							编辑联系人： ${contact.name }
					</div>
					
					<div class="main" id="main" style="padding-top:20px;">
				<table id="edit-contact" style="width:100%;">
					<tbody>
					<tr id="contact-edit-form" style="display: table-row; ">
						<td class="avatar">
							
						</td>
						<td>
						<form id="myform" accept-charset="UTF-8" action="update.action" class="simple_form form-horizontal" id="contact_form" method="post" novalidate="novalidate">
							<div style="margin:0;padding:0;display:inline">
								<input name="utf8" type="hidden" value="?">
								<input name="_method" type="hidden" value="put">
								<input name="authenticity_token" type="hidden" value="TW1oOcB6xhhqHU5rw9O9TL7NKdiHrS8z+uCBk+qQibI=">
							</div>
							<input name="contact.id" type="hidden" value="${contact.id }"/>
							<div class="control-group string required"><label class="string required control-label" for="person_name"><abbr title="required" style="color:red;">*</abbr> 姓名</label><div class="controls"><input class="string required" id="person_name" name="contact.name" size="50" type="text" value="${contact.name }"></div></div>
							<div class="control-group string optional"><label class="string optional control-label" for="person_title"> 职位</label><div class="controls"><input class="string optional" id="person_title" name="contact.title" size="50" type="text" value="${contact.title }"></div></div>
							
							<div class="control-group string optional marco_polo_container"><label class="string optional control-label" for="person_company_name"> 公司</label><div class="controls"><input class="string optional input-xlarge mp_input" id="person_company_name" name="contact.companyname" size="50" type="text" value="${contact.title }" autocomplete="off"><ul class="typeahead dropdown-menu mp_list" style="display: none; "></ul></div></div>
							<input id="person_company_id" name="company.id" type="hidden" value="">
							<input id="companyname" value="${contact.companyname }" type="hidden"/>
							<input id="companyid" value="${contact.company.id }" type="hidden"/>
							
							
							
							<!-- 电话 -->
							
							<div class="control-group tel optional">
							<label class="tel optional control-label" for="person_contact_phone">
								电话
							</label>
							
							<div class="controls">
								<div class="contact_forms contact_phones" id="contact_phone_list_company">
								
									<c:choose>
									
									<c:when test="${empty contact.telList }">
									
									<div id="blank_slate_company_contact_phone" class="blank_slate" >
										添加一个电话号码
									</div>
									
									<div class="contact_methods" style="display: none; ">
										
										<div id="contact_phone_97e92dd0-c133-012f-5d39-000c29568e7b" class="contact_method new_contact_method edit_phone">
						
											<input class="autofocus" id="person_contact_phones__value" name="telnums" size="30" type="text" >
											
											<input class="myinput" type="hidden" name="telids" value=""/>
											<select id="person_contact_phones__key" name="teltypes">
												<option value="office" selected="selected">工作</option>
												<option value="home">家庭</option>
												<option value="other" selected="selected">其它</option>
											</select>
											<span class="addremove" >
												<a href="javascript:;" class="remove">
													<span class="icon-remove"></span>
												</a>
											</span>
										</div>
										<div id="add_company_contact_phone" class="add_contact_method" style="display: none;">
										  <div class="add"><a href="javascript:;">添加..</a></div>
										</div>
									</div>
									</c:when>
									
									<c:otherwise>
									<!--  -->
										<div id="blank_slate_company_contact_phone" class="blank_slate" style="">
										添加一个电话号码
										</div>
										
										<div class="contact_methods" style="display: none; ">
											
											<c:forEach items="${contact.telList }" var="tel">
											<div  class="contact_method new_contact_method edit_phone">
											<input class="autofocus" id="person_contact_phones__value" name="telnums" size="30" type="text" value="${tel.tel }"/>
											<input type="hidden" name="telids" value="${tel.id }"/>
											<select id="person_contact_phones__key" name="teltypes" >
											<c:choose>
													<c:when test="${tel.type =='office' }">
														<option value="office" selected="selected">工作</option>
													</c:when>
													
													<c:otherwise>
														<option value="office">工作</option>
													</c:otherwise>
												</c:choose>
												
												<c:choose>
													<c:when test="${tel.type =='home' }">
														<option value="home" selected="selected">家庭</option>
													</c:when>
													
													<c:otherwise>
														<option value="home">家庭</option>
													</c:otherwise>
												</c:choose>
												
												<c:choose>
													<c:when test="${tel.type =='other' }">
														<option value="other" selected="selected">其它</option>
													</c:when>
													
													<c:otherwise>
														<option value="other">其它</option>
													</c:otherwise>
												</c:choose>
											</select>
											<span class="addremove"><a href="#" class="remove"><span class="icon-remove"></span></a></span>
											</div>
											</c:forEach>
											
											<div id="add_company_contact_phone" class="add_contact_method" style="display: none;">
											  <div class="add"><a href="javascript:;">添加..</a></div>
											</div>
										</div>
									
									
									</c:otherwise>
									
								</c:choose>
								</div>
								
								<!--动态生成标签-->
							<script type="text/javascript">
								//<![CDATA[
								$(document).ready(function() {
									var contact_phone_manger = new ContactInfo.ContactForm("#contact_phone_list_company", "<div  class=\"contact_method new_contact_method edit_phone\">\n	\n		<input class=\"autofocus\" id=\"person_contact_phones__value\" name=\"telnums\" size=\"30\" type=\"text\" />\n	<input type=\"hidden\" name=\"telids\" value=\"\">\n	<select id=\"person_contact_phones__key\" name=\"teltypes\"><option value=\"work\">工作<\/option>\n<option value=\"home\">家庭<\/option>\n<option value=\"other\">其它<\/option><\/select>\n		<span class=\"addremove\"><a href=\"#\" class=\"remove\"><span class=\"icon-remove\"></span><\/a><\/span>\n<\/div>");
									setInterval(function(){
										if(contact_phone_manger.present()){
											contact_phone_manger.toggle();
										}
									}, 1000);
								}) ;
								//]]>
							</script>
							
								</div>
							</div>
							
							<!-- 邮件 -->
							<div class="control-group email optional">
							<label class="email optional control-label" for="person_contact_email"> 
								邮箱
							</label>
							<div class="controls">
								<div class="contact_forms contact_emails" id="contact_email_list_company">
							
							<c:choose>
								<c:when test="${empty contact.mailList }">
									<div id="blank_slate_company_contact_email" class="blank_slate" style="">
									添加一个Email地址
									</div>
									<div class="contact_methods" style="display: none; ">
									
									<div id="contact_email_97f05fd0-c133-012f-5d3a-000c29568e7b" class="contact_method new_contact_method edit_phone">
							
										<input class="autofocus" id="person_contact_emails__value" name="mails" size="30" type="text">
										<select id="person_contact_emails__key" name="mailtypes">
											<option value="work">工作</option>
											<option value="personal">个人</option>
											<option value="other">其它</option>
										</select>
										<span class="addremove">
											<a href="javascript:;" class="remove"><span class="icon-remove"></span></a>
										</span>
									</div>
									<div id="add_company_contact_email" class="add_contact_method" style="display: none;">
									  <div class="add"><a href="javascript:;">添加..</a></div>
									</div>
									</div>
									
								</c:when>
								
								<c:otherwise>
									<div id="blank_slate_company_contact_email" class="blank_slate" style="">
									添加一个Email地址
									</div>
									<div class="contact_methods" style="display: none; ">
									
									<c:forEach items="${contact.mailList }" var="mail">
									<div  class="contact_method new_contact_method edit_phone">
									<input class="autofocus" id="person_contact_emails__value" name="mails" size="30" type="text" value="${mail.mail }"/>
									<input type="hidden" name="mailids" value="${mail.id }"/>
									<select id="person_contact_emails__key" name="mailtypes">
									<c:choose>
									<c:when test="${mail.type =='office' }">
										<option value="office" selected="selected">工作</option>
									</c:when>
									
									<c:otherwise>
										<option value="office">工作</option>
									</c:otherwise>
									</c:choose>
									
									<c:choose>
										<c:when test="${mail.type =='personal' }">
											<option value="personal" selected="selected">个人</option>
										</c:when>
										
										<c:otherwise>
											<option value="personal">个人</option>
										</c:otherwise>
									</c:choose>
									
									<c:choose>
										<c:when test="${mail.type =='other' }">
											<option value="other" selected="selected">其它</option>
										</c:when>
										
										<c:otherwise>
											<option value="other">其它</option>
										</c:otherwise>
									</c:choose>
									</select>
									<span class="addremove"><a href="#" class="remove"><span class="icon-remove">
									</span></a></span></div>
									</c:forEach>
									
									<div id="add_company_contact_email" class="add_contact_method" style="display: none;">
									  <div class="add"><a href="javascript:;">添加..</a></div>
									</div>
									</div>
									
								</c:otherwise>
								
							</c:choose>
								
						</div>
						<script type="text/javascript">
							//<![CDATA[
							$(document).ready(function() {
								var contact_email_manger = new ContactInfo.ContactForm("#contact_email_list_company", "<div  class=\"contact_method new_contact_method edit_phone\">\n	\n		<input class=\"autofocus\" id=\"person_contact_emails__value\" name=\"mails\" size=\"30\" type=\"text\" />\n	<input type=\"hidden\" name=\"mailids\" value=\"\">	\n<select id=\"person_contact_emails__key\" name=\"mailtypes\"><option value=\"work\">工作<\/option>\n<option value=\"personal\">个人<\/option>\n<option value=\"other\">其它<\/option><\/select>\n		<span class=\"addremove\"><a href=\"#\" class=\"remove\"><span class=\"icon-remove\"></span><\/a><\/span>\n<\/div>");
								setInterval(function(){
									if(contact_email_manger.present()){
										contact_email_manger.toggle();
									}
								}, 1000);
							}) ;
							//]]>
						</script>
						
							</div>
						</div>
							
							
						<!-- IM -->	
						
						<div class="control-group string optional">
						<label class="string optional control-label" for="person_contact_im"> IM</label>
						<div class="controls">
						<div class="contact_forms contact_ims" id="contact_im_list_company">
						
						<c:choose>
							<c:when test="${empty contact.imList }">
								<div id="blank_slate_company_contact_im" class="blank_slate" style="">添加一个即时聊天帐号</div>
								<div class="contact_methods" style="display: none; ">
									
									<div id="contact_im_97f32740-c133-012f-5d3b-000c29568e7b" class="contact_method new_contact_method edit_phone">
							
										<input class="autofocus" id="person_contact_ims__value" name="ims" size="30" type="text">
										<input type="hidden" name="imids" value="">
										<select id="person_contact_ims__key" name="imtypes">
											<option value="qq">QQ</option>
											<option value="gtalk">GTalk</option>
											<option value="msn">MSN</option>
									
										</select>
										<span class="addremove">
											<a href="javascript:;" class="remove"><span class="icon-remove"></span></a>
										</span>
									</div>
									<div id="add_company_contact_im" class="add_contact_method" style="display: none;">
									  <div class="add"><a href="javascript:;">添加..</a></div>
									</div>
								</div>
							</c:when>
						
							<c:otherwise>
								<div id="blank_slate_company_contact_im" class="blank_slate" style="">添加一个即时聊天帐号</div>
								<div class="contact_methods" style="display: none; ">
								
								<c:forEach items="${contact.imList }" var="im">
									<div class="contact_method new_contact_method edit_phone">
										<input class="autofocus" id="person_contact_ims__value" name="ims" size="30" type="text" value="${im.im }">
										<input type="hidden" name="imids" value="${im.id }">
										<select id="person_contact_ims__key" name="imtypes">
										<c:choose>
										<c:when test="${im.type =='qq' }">
											<option value="qq" selected="selected">QQ</option>
										</c:when>
										<c:otherwise>
											<option value="qq">QQ</option>
										</c:otherwise>
										</c:choose>
										
										<c:choose>
											<c:when test="${im.type =='gtalk' }">
												<option value="gtalk" selected="selected">GTalk</option>
											</c:when>
											<c:otherwise>
												<option value="gtalk">GTalk</option>
											</c:otherwise>
										</c:choose>
										
										<c:choose>
											<c:when test="${im.type =='msn' }">
												<option value="msn" selected="selected">MSN</option>
											</c:when>
											<c:otherwise>
												<option value="msn">MSN</option>
											</c:otherwise>
										</c:choose>
											
										</select>
										<span class="addremove">
											<a href="javascript:;" class="remove"><span class="icon-remove"></span></a>
										</span>
									</div>
									
								</c:forEach>
								<div id="add_company_contact_im" class="add_contact_method" style="display: none;">
								  <div class="add"><a href="javascript:;">添加..</a></div>
								</div>
								</div>
							</c:otherwise>
						
						</c:choose>
						</div>
					<script type="text/javascript">
						//<![CDATA[
						$(document).ready(function() {
							var contact_im_manger = new ContactInfo.ContactForm("#contact_im_list_company", "<div  class=\"contact_method new_contact_method edit_phone\">\n	\n		<input class=\"autofocus\" id=\"person_contact_ims__value\" name=\"ims\" size=\"30\" type=\"text\" />\n	<input type=\"hidden\" name=\"imids\" value=\"\">	\n<select id=\"person_contact_ims__key\" name=\"imtypes\"><option value=\"qq\">QQ<\/option>\n<option value=\"gtalk\">GTalk<\/option>\n<option value=\"msn\">MSN<\/option>\n<\/select>\n		<span class=\"addremove\"><a href=\"#\" class=\"remove\"><span class=\"icon-remove\"></span><\/a><\/span>\n<\/div>");
							setInterval(function(){
								if(contact_im_manger.present()){
									contact_im_manger.toggle();
								}
							}, 1000);
						}); 
						//]]>
					</script>
						</div>
					</div>	
							
							
					<!-- 网站 -->		
					<div class="control-group string optional"><label class="string optional control-label" for="person_contact_website"> 网站</label>
					<div class="controls">
						<div class="contact_forms contact_websites" id="contact_website_list_company">
					<c:choose>
						<c:when test="${empty contact.websiteList }">
							<div id="blank_slate_company_contact_website" class="blank_slate" style="">添加一个网址</div>
							<div class="contact_methods" style="display: none; ">
								
								<div id="contact_website_9824b6f0-c133-012f-5d3c-000c29568e7b" class="contact_method new_contact_method edit_phone">
						
									<input class="autofocus" id="person_contact_websites__value" name="websites" size="30" type="text">
									<input type="hidden" name="websiteids" value="">
										<select id="person_contact_websites__key" name="websitetypes">
											<option value="office">公司</option>
											<option value="personal">个人</option>
											<option value="other">其它</option>
										</select>
										<span class="addremove">
											<a href="javascript:;" class="remove"><span class="icon-remove"></span></a>
										</span>
								</div>
								<div id="add_company_contact_website" class="add_contact_method" style="display: none;">
								  <div class="add"><a href="javascript:;">添加..</a></div>
								</div>
							</div>
						</c:when>
						
						<c:otherwise>
							<div id="blank_slate_company_contact_website" class="blank_slate" style="">添加一个网址</div>
							<div class="contact_methods" style="display: none; ">
								<c:forEach items="${contact.websiteList }" var="website">
								<div class="contact_method new_contact_method edit_phone">
									<input class="autofocus" id="person_contact_websites__value" name="websites" size="30" type="text" value="${website.website }">
									<input type="hidden" name="websiteids" value="${website.id }">
										<select id="person_contact_websites__key" name="websitetypes">
										<c:choose>
										<c:when test="${website.type =='office' }">
											<option value="office" selected="selected">公司</option>
										</c:when>
										
										<c:otherwise>
											<option value="office">公司</option>
										</c:otherwise>
										</c:choose>
										
										<c:choose>
											<c:when test="${website.type =='personal' }">
												<option value="personal" selected="selected">个人</option>
											</c:when>
											
											<c:otherwise>
												<option value="personal">个人</option>
											</c:otherwise>
										</c:choose>
										
										<c:choose>
											<c:when test="${website.type =='other' }">
												<option value="other" selected="selected">其它</option>
											</c:when>
											
											<c:otherwise>
												<option value="other">其它</option>
											</c:otherwise>
										</c:choose>
										</select>
										<span class="addremove">
											<a href="javascript:;" class="remove"><span class="icon-remove"></span></a>
										</span>
								</div>
								</c:forEach>
								<div id="add_company_contact_website" class="add_contact_method" style="display: none;">
								  <div class="add"><a href="javascript:;">添加..</a></div>
								</div>
							</div>
						</c:otherwise>
					</c:choose>		
							
				</div>
				<script type="text/javascript">
					//<![CDATA[
					$(document).ready(function() {
						var contact_website_manger = new ContactInfo.ContactForm("#contact_website_list_company", "<div  class=\"contact_method new_contact_method edit_phone\">\n	\n		<input class=\"autofocus\" id=\"person_contact_websites__value\" name=\"websites\" size=\"30\" type=\"text\" />\n	<input type=\"hidden\" name=\"websiteids\" value=\"\">	\n<select id=\"person_contact_websites__key\" name=\"websitetypes\"><option value=\"office\">公司<\/option>\n<option value=\"personal\">个人<\/option>\n<option value=\"other\">其它<\/option><\/select>\n		<span class=\"addremove\"><a href=\"#\" class=\"remove\"><span class=\"icon-remove\"></span><\/a><\/span>\n<\/div>");
						setInterval(function(){
							if(contact_website_manger.present()){
								contact_website_manger.toggle();
							}
						}, 1000);
					});
					//]]>
				</script>
						</div>
					</div>			
							
							
					<div class="control-group string optional">
						<label class="string optional control-label" for="person_contact_address">
							地址
						</label>
						<div class="controls">
							<input class="string optional" id="person_contact_addresses__value" name="contact.address" size="30" type="text" value="${contact.address }">
						</div>
					</div>
			
			
					<input id="person_contact_sns_attributes_0_key" name="person[contact_sns_attributes][0][key]" type="hidden" value="weibo">
					<div class="control-group string optional">
						<label class="string optional control-label" for="person_contact_sns_attributes_0_value">微博</label>
							<div class="controls">
								<input class="string optional" id="person_contact_sns_attributes_0_value" name="contact.weibo" size="50" type="text" value="${contact.weibo }">
								<span class="add-on">@</span>
								<select id="" name="contact.weibotype" style="width:60px">
									<c:choose>
										<c:when test="${contact.weibotype == 'weibo.com' }">
											<option value="weibo.com" selected="selected">新浪</option>
										</c:when>
										<c:otherwise>
											<option value="weibo.com">新浪</option>
										</c:otherwise>
									</c:choose>
									<c:choose>
										<c:when test="${contact.weibotype == 'qq.com' }">
											<option value="qq.com" selected="selected">腾讯</option>
										</c:when>
										<c:otherwise>
											<option value="qq.com">腾讯</option>
										</c:otherwise>
									</c:choose>
								</select>
								<p class="help-block">输入微博昵称或ID</p>
							</div>
					</div>		
							
							
					<div class="control-group text optional">
						<label class="text optional control-label" for="person_others"> 背景信息</label>
						<div class="controls">
							<textarea class="text optional content sapn2" cols="40" id="person_others" name="contact.content" rows="6">${contact.content }</textarea>
							<p class="help-block">简介，如何认识的等</p>
						</div>
					</div>		
							
							
					<!--选择可见性的部分-->
			<div class="control-group string optional"><label class="string optional control-label" for="person_access_policy"> 谁可以看见？</label><div class="controls">
			
			 <div id="select_access_policy_for_Contact_" class="select_access_policy">
			 
			<input type="hidden" id="myview" value="${contact.view }">
			<div class="radio scope activated">
				<input style="margin-top:0px;" checked="checked" id="person_access_policy_attributes_scope_everyone" name="contact.view" type="radio" value="a"> <div style="height:20px;padding-top:5px;">所有同事</div>
			</div>
			<div class="radio scope">
				<input  style="margin-top:0px;" id="person_access_policy_attributes_scope_owner" name="contact.view" type="radio" value="m:${sessionScope.user.id }"> <div style="height:20px;padding-top:5px;"> 只有我能看见</div>
			</div>
			<div class="radio scope " >
				<input style="margin-top:0px;" id="person_access_policy_attributes_scope_namedgroup" name="contact.view" type="radio" value="NamedGroup"> <div style="height:20px;padding-top:5px;"> 选择一个组...
					<div class="editor" style="float:right;margin-right:220px;">
						<select class="named_group" id="group" name="person[access_policy_attributes][group_id]">
							<option value="">选择一个组</option>
							<c:forEach items="${groups }" var="group">
								<option value="m:${sessionScope.user.id},g:${group.id }">${group.groupname }</option>
							</c:forEach>							
						</select> 
					</div>
				</div>
			</div>
		
		</div>
		</div>
	

		<script>
			var container = $('#select_access_policy_for_Contact_');
			$('.scope input[type=radio]', container).live('click', function(event) {
			var activated = $(event.target).parent();
			$('.scope.activated', container).removeClass('activated');
			activated.addClass('activated');
				changePermission();
		  });
			
			$(document).ready(function(){
				
				$("#group").change(function() {
					$("#person_access_policy_attributes_scope_namedgroup").attr("value",$("#group").val());
				});
				
				$("#member").change(function() {
					$("#person_access_policy_attributes_scope_adhocgroup").attr("value",$("#member").val());
				});
			});

		</script>
		
			</div>		
							
					<input id="person_access_policy_attributes_id" name="person[access_policy_attributes][id]" type="hidden" value="1656915"></div></div>
					<div class="form-actions">
						<input class="btn btn-primary" data-loading-text="处理中.." name="commit" type="submit" value="保存修改" id="mybtn">
							<a href="show.action?id=${contact.id }" class="btn">取消</a>
					</div>
					</form>
					<script type="text/javascript" charset="utf-8">
						$(document).ready(function() {
							
							$('#person_company_name').marcoPolo({
							  url: 'search.action',
							  formatItem: function (data, $item) {
							    return data.name;
							  },
							  onSelect: function (data, $item) {
							  	$('#person_company_name').val(data.name);
								$('#person_company_id').val(data.id);
							  }
							  
							});
							
							$('#person_company_name').keydown(function() {
								$('#person_company_id').attr("value","");
							});
							
							$('#person_company_name').val($("#companyname").val());
							$('#person_company_id').val($("#companyid").val());
							validate_form("#contact_form");
							$('#person_name').focus();
						});
					</script>
						</td>
					</tr>
					</tbody>
				</table>

				<script type="text/javascript" charset="utf-8">
					$(initMergeCandidate);
				</script>

					</div>
	
			</div>
		</div>	
	</div>
		
</body>
</html>
